package org.example;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/** Hello world! */
public class App {
  // 创建线程池,策略选用超出阻塞队列的任务交由主线程执行
  private static final ThreadPoolExecutor executor =
      new ThreadPoolExecutor(
          4,
          8,
          30L,
          TimeUnit.SECONDS,
          new LinkedBlockingQueue<>(1000),
          new ThreadPoolExecutor.CallerRunsPolicy());

  public static void main(String[] args) throws InterruptedException {
    List<String> list = Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
    String[] array = list.toArray(new String[0]);
    for (String s : array) {
      System.out.println(s);
    }
  }
}
